import java.util.Arrays;
import java.util.Scanner;

public class Test {
    public static int findMore(int[] array){
        int ret = 0;
        

        return ret;
    }
    public static void main(String[] args) {
        System.out.println("输入元素个数：");
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        int[] array = new int[num];
        for (int i = 0; i < array.length; i++) {
            array[i] = scan.nextInt();
        }

    }
    public static int findSingleDog(int[] array){
        int ret = 0;
        for (int i = 0; i < array.length; i++) {
            ret ^= i;
        }
        return ret;
    }
    public static void main6(String[] args) {
        System.out.println("输入数组元素个数：");
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        int[] array = new int[num];
        System.out.println("输入数组元素：");
        for (int i = 0; i < array.length; i++) {
            array[i] = scan.nextInt();
        }
        int find = findSingleDog(array);
        System.out.println("只出现一次的元素是 "+find);
    }
    public static int[] towIndex(int[] nums,int target){
        int[] array = {-1, -1};
        for(int i = 0;i < nums.length; i++){
            for(int j = 0;j < nums.length; j++){
                if(i != j && nums[i] + nums[j] == target){
                    array[0] = i;
                    array[1] = j;
                }
            }
        }
        return array;
    }
    public static void main5(String[] args) {
        int[] arr = {2,7,11,15};
        Scanner scan = new Scanner(System.in);
        int target = scan.nextInt();
        int[] tow_number = towIndex(arr,target);
        System.out.println(Arrays.toString(tow_number));
    }
    public static void bubbleSort(int[] array){
        for(int i = 0; i < array.length; i++){
            boolean flag = false;
            for(int j = 0; j < array.length - 1 - i; j++){
                if(array[j] > array[j+1]){
                    int tmp = array[j];
                    array[j] = array[j+1];
                    array[j+1] = tmp;
                    flag = true;
                }
            }
            if(flag == false){
                return;
            }
        }
    }
    public static void main4(String[] args) {
        int[] array = {8,7,2,4,5,1,0,3,9,6};
        bubbleSort(array);
        System.out.println(Arrays.toString(array));
    }
    public static int binarySearch(int[] array, int key){
        int left = 0;
        int right = array.length - 1;
        while(left <= right){
            int mid = (left + right) / 2;
            if(array[mid] == key){
                return mid;
            }else if(array[mid] > key){
                right = mid - 1;
            }else{
                left = mid + 1;
            }
        }
        return -1;
    }
    public static void main3(String[] args) {
        int[] array = {1,2,3,4,5,6,7,8,9,10};
        int index = binarySearch(array,6);
        System.out.println(index);
    }
    public static void swap(int[] array){
        int str = 0;
        int end = array.length - 1;
        while(str < end) {
            if(array[str] % 2 == 0 && array[end] % 2 == 1){
                int tmp = array[str];
                array[str] = array[end];
                array[end] = tmp;
                str++;
                end--;
            } else if(array[end] % 2 == 0) {
                end--;
            } else if(array[str] % 2 == 1){
                str++;
            }
        }
    }
    public static void main2(String[] args) {
        int[] arr = {1,2,3,4,5,6};
        swap(arr);
        System.out.println(Arrays.toString(arr));
    }
    public static void transform(int[] array){
        for (int i = 0; i < array.length; i++) {
            array[i] = array[i] * 2;
        }
    }
    public static void main1(String[] args) {
        //二分查找
        int[] arr = new int[]{2,5,8,4,52};
        System.out.println(Arrays.toString(arr));
        System.out.println("transform");
        transform(arr);
        System.out.println(Arrays.toString(arr));
    }
}
